﻿using PelitaProduksi.Controller;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PelitaProduksi.Helper
{
    internal class LoginHelper
    {
        private static LoginHelper _instance;
        private LoginHelper()
        {
        }
        public static LoginHelper Instance
        {
            get
            {
                if (_instance == null) _instance = new LoginHelper();
                return _instance;
            }
        }
        public bool CheckLogin(string user, string pass)
        {
            MySQLController c = new MySQLController();
            c.Open();
            object result = c.ExecuteScalar(string.Format("select count(*) from pro_usr where pwd='{0}' and user='{1}' and aktif=1 ", pass, user));
            int count = Int32.Parse(result.ToString());
            c.Close();
            return count==1;
        }
    }
}
